import {axios,axiosFile} from '@u/request'
// 用户信息初始化时候发送的请求
const getCompanyList = (params = {}) => axios.post('/back/company', params)
// 新增请求
const addClient = (params = {}) => axios.post('/back/company/update', params)
// 请求销售人员
const getSaleP = (params = {}) => axios.get('/back/company/getUsers',{params})
//获取客户详情
const getDetail = (id:any) => axios.get('/back/company/id/' + id)
// 修改用户提交
const update = (data:any) => axios.post('/back/company/update',data)
// 导入
export const importExcel = (file:any, id:any)=>{
    const data = new FormData()
    data.append('file', file)
    data.append('companyId', id)
    return axios({
      url: '/back/company/importExcel',
      method: 'POST',
      headers: { 'Content-Type': 'multipart/form-data' },
      timeout: 180000,
      data: data
    })
  }
// 跟随上传请求
const followUpReq = (params = {}) => axios.post('/back/connectInfo/save', params)
// 删除请求 
const delReq = (id:any)=>  axios.delete('/back/company/id/' +id)
//导出
export const exportTask = (data:any) => axiosFile({
  method: 'post',
  data,
  url: `/back/company/export`
}) 
// 导出模版    
export const exportTaskStencil = () => axiosFile({
  method: 'get',
  url: `/back/company/template`
}) 
export { getCompanyList,addClient, getSaleP,followUpReq,getDetail,update,delReq}